#!/usr/bin/env python

# example label.py

import pygtk
pygtk.require('2.0')
import gtk
import menu

class Labels:
    def button_press(self,widget,data=None):
      #print dir(self.menu.menubar)
      print (self.menu.menubar.get_children()[3].get_children()[0].get_data('S'))
      print (self.menu.menubar.get_children()[3].get_children()[0].get_state().real)
      #widget.set_active(False)
      self.label.set_label('Pressed')
      if self.is_shown:
	self.is_shown = False
	self.vbox1.hide()
      else:
	self.is_shown = True
	self.vbox1.show()	
      
    def __init__(self):
      self.is_shown = True
      self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
      self.window.connect("destroy", lambda w: gtk.main_quit())
      self.window.set_title("Label")
      self.vbox1 = gtk.VBox(False, 5)
      self.vbox2 = gtk.VBox(False, 5)
      hbox = gtk.VBox(False, 5)
      
      self.window.add(hbox)
      hbox.show()
      self.menu = menu.myMenu()
      self.menu.add_item(("/Web/Show|Hide address bar","<control>T", self.button_press,self.is_shown,"<CheckItem>"))
      self.menu.add_item(("/Web/Show address bar",None, self.button_press,0,"<RadioItem>"))
      self.menu.add_item(("/Web/S",None, self.button_press,0,"<ToggleItem>"))
      hbox.pack_start(self.vbox1, False, False, 0)
      hbox.pack_start(self.vbox2, False, False, 0)
      self.vbox1.set_size_request(300,300)
      self.vbox2.set_size_request(300,300)
      self.window.set_border_width(5)

      self.label = gtk.Label("This is a Normal label")
      
      self.vbox1.pack_start(self.label, False, False, 0)
      
      button = gtk.Button("press me")
      button.connect_object("clicked",self.button_press,"ok")
      
      self.vbox2.pack_start(button, False, False, 0)
      self.menu.generate_menu(hbox,self.window)
      self.window.show_all ()

def main():
    gtk.main()
    return 0

if __name__ == "__main__":
    Labels()
    main()